<?php


// Get a news by $id
function getNews($id){
	global $db;
	if ($id=="") return false;
	$sql="SELECT * FROM news WHERE id=".$id;
	$results=$db->query($sql);		
	return $db->fetchNextObject($results);
}

// Get a download by $id
function getDownload($id){
	global $db;
	if ($id=="") return false;
	$sql="SELECT * FROM download WHERE id=".$id;
	$results=$db->query($sql);		
	return $db->fetchNextObject($results);
}

// Get a product by $id
function getProduct($id){
	global $db,$langid;
	if ($id=="") return false;
	$sql="SELECT * FROM products,products_des WHERE products.id=products_des.id and languages_id=$langid and products.id=".$id;
	$results=$db->query($sql);		
	return $db->fetchNextObject($results);
}

// Get a catergory by $id
function getCategory($id){
	global $db,$langid;
	if ($id=="") return false;
	$sql="SELECT * FROM categories WHERE id=".$id;
	$results=$db->query($sql);		
	return $db->fetchNextObject($results);
}

// Get a doc by $id
function getDoc($id){
	global $db,$langid;
	if ($id=="") return false;
	$sql="SELECT * FROM content as c,content_des as cdes WHERE c.id=cdes.id and languages_id=$langid and c.id=".$id;
	$results=$db->query($sql);		
	return $db->fetchNextObject($results);
}
?>